import request from '@/utils/request'
function getToken() {
  const token = localStorage.getItem('token')
  return token
}
export async function Login(params) {
  return request('/hzsx/user/login', {
    method: 'POST',
    data: params,
    headers: { token: getToken() }
  })
}
export async function getFakeCaptcha(mobile) {
  return request(`/api/login/captcha?mobile=${mobile}`)
}

export async function homeData(params) {
  return request('/hzsx/ope/order/opeOrderStatistics', {
    method: 'POST',
    data: params,
    headers: { token: getToken() }
  })
}
export async function queryOrderReport(params) {
  return request('/hzsx/ope/order/queryOrderReport', {
    method: 'POST',
    data: params,
    headers: { token: getToken() }
  })
}
export async function selectProductCounts(params) {
  return request('/hzsx/home/selectProductCounts', {
    method: 'get',
    data: params,
    headers: { token: getToken() }
  })
}

export async function sendValidateCode(params) {
  return request(
    `/hzsx/user/sendValidateCode?mobile=${params.mobile}&code=001`,
    {
      method: 'get',
      data: params,
      headers: { token: getToken() }
    }
  )
}

export async function restPassword(params) {
  return request('/hzsx/user/restPassword', {
    method: 'POST',
    data: params,
    headers: { token: getToken() }
  })
}

export async function getUserStatistics(params) {
  return request(`/hzsx/user/getUserStatistics`, {
    method: 'get',
    data: params,
    headers: { token: getToken() }
  })
}

// 查询风控账户余额
export async function getUserRemain(params) {
  return request(`/hzsx/ope/order/queryOpeRemainAmount`, {
    method: 'get',
    headers: { token: getToken() }
  })
}
